import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import { createViteProxy } from './vite/proxy'
import vitePlugins from './vite/plugins'
import viteBuild from './vite/build'

export default defineConfig({
  base: '/vue-admin/',
  plugins: vitePlugins,
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
    extensions: ['.js', '.vue'],
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `
          @import '@/assets/styles/var.scss';
        `,
      },
    },
  },
  server: {
    proxy: createViteProxy(),
  },
  build: viteBuild,
})
